/*
 * InputMediaSource.h
 *
 *  Created on: 2018年6月24日
 *      Author: zhengboyuan
 */

#ifndef SRC_INPUTMEDIASOURCE_H_
#define SRC_INPUTMEDIASOURCE_H_

#include "MediaSource.h"
#include "PacketQueue.h"
#include "MFormat.h"


namespace av
{

class InputMediaSource : public MediaSource
{
public:
    InputMediaSource();
    virtual ~InputMediaSource();

    virtual int open(const MFormat& fmt);

    virtual bool write(MPacket& pkt);

    virtual void flush();



    virtual int open(const std::string& url, const std::string& params);

    virtual void close();

    virtual bool isOpen();

    virtual bool getFormat(MediaFormat& fmt);

    virtual int getDuration();

    virtual int play();
    virtual int pause();
    virtual void stop();

    virtual int getState();

    virtual bool seekable();

    virtual int seek(int64_t offset);

    virtual int64_t getTime();

    virtual int setScale(float scale);

    virtual float getScale();

    virtual int read(AVPacket& pkt);

    virtual void interrupt();

    virtual bool isLive();

    virtual bool getMetaData(const std::string& key, std::string& value);

protected:
    PacketQueue m_pktQueue;
    MediaFormat m_format;


};


} /* namespace av */

#endif /* SRC_INPUTMEDIASOURCE_H_ */
